class Newsletter < ActionMailer::Base
  def monthly_newsletter(books)
     #raise Exception.new
     recipients "claude.gueant@emerades.org"
     from       "newsletter@books.com"
     subject    "Les news du mois"
     content_type "text/html"
     body       :books => books,
                :home_page => url_for(:host => "localhost", :port => 3000, :controller => "books", :action => "index")
   end
   
   def free_ebook(book)
     recipients "cgueant@infhotep.com"
     from       "newsletter@books.com"
     subject    "Un ebook gratuit : #{book.title}"
     
     part :content_type => "text/plain",
        :body => "Voilà votre livre gratuit ! "
     
     attachment :content_type => "application/pdf",
        :filename => "yourfreebook.pdf",
        :body => File.read(RAILS_ROOT + "/app/views/newsletter/freebook.pdf")
    end
end
